/** UserSessionThreadLocal */
package domain.session;

/**
 * Useful for threads which have different SESSIONs
 * @author jessienewman
 * @version $Revision: 1.0 $
 */
public class UserSessionThreadLocal {
	
	/**
	 * Field localSession.
	 */
	private static final ThreadLocal<UserSession> LOCALSESSION = 
		new ThreadLocal<UserSession>();
	
	/**
	 * Method set.
	 * @param session UserSession
	 */
	public static void set(UserSession session) {
		LOCALSESSION.set(session);
	}
	
	/**
	 * Method get.
	
	 * @return UserSession */
	public static UserSession get() {
		return LOCALSESSION.get();
	}

	/**
	 * Method setInitialValue.
	
	 * @return UserSession */
	public static UserSession makeInitialValue() {
		final UserSession session = new UserSession(0, 0);
		LOCALSESSION.set(session);
		return session;
	}
	
	/**
	 * Method toString.
	
	 * @return String */
	public String toString() {
		return super.toString();
	}
}
